package com.apps.express.Express100.model.po;

import com.apps.sannotation.constraints.NoNull;
import com.apps.saspect.ValidMethod;
import com.apps.sexctption.NullException;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jodd.util.StringUtil;
import lombok.Data;

@ApiModel("物流地区信息")
@Data
public class ExpressRouteItem {

    @ApiModelProperty("地区编码")
    private String number="";
    @ApiModelProperty("地区名称")
    private String name="";

    @ValidMethod
    public void setNumber(@NoNull String number) {
        this.number = number;
    }

    @ValidMethod
    public void setName(@NoNull String name) {
        this.name = name;
    }

    public ExpressRouteItem(String number, String name) {
        if(null == number)
            throw new NullException("地区编码不能为空");
        if(StringUtil.isEmpty(name))
            throw new NullException("地区名称不能为空");
        this.number = number;
        this.name = name;
    }

    public ExpressRouteItem()
    {

    }
}
